import request from '@/utils/request'

// 查询项目角色列表
export function listRole(query) {
    return request({
        url: '/admin-api/system/project-role/page',
        method: 'get',
        params: query
    })
}

export function listRoleAllocation(query) {
    return request({
        url: '/business/project/role/allocation/list',
        method: 'get',
        params: query
    })
}

// 查询项目角色详细
export function getRole(projectRoleId) {
    return request({
        url: '/admin-api/system/project-role/get?id=' + projectRoleId,
        method: 'get'
    })
}

// 新增项目角色
export function addRole(data) {
    return request({
        url: '/admin-api/system/project-role/create',
        method: 'post',
        data: data
    })
}

// 修改项目角色
export function updateRole(data) {
    return request({
        url: '/admin-api/system/project-role/update',
        method: 'put',
        data: data
    })
}

// 删除项目角色
export function delRole(projectRoleId) {
    return request({
        url: '/admin-api/system/project-role/delete?id=' + projectRoleId,
        method: 'delete'
    })
}

// 下拉选择
export function getProjectRoleListSimple(query) {
    return request({
        url: '/admin-api/system/project-role/list-all-simple',
        method: 'get',
        params: query
    })
}

// 查询项目用户有哪些项目角色
export function getProjectRoleUser(query) {
    return request({
        url: '/admin-api/system/project-role/user',
        method: 'get',
        params: query
    })
}

export function selectLoopGroup(projectRoleId) {
    return request({
        url: '/admin-api/business/project-role/loopGroup/' + projectRoleId,
        method: 'get'
    })
}

export function authLoopGroup(data) {
    return request({
        url: '/admin-api/business/project-role/auth/loopGroup',
        method: 'post',
        data: data
    })
}
